package com.yunji.common.enums.business;

import com.yunji.common.utils.bean.BeanUtils;

import java.util.Objects;

/**
 * @Project: yunji-coffee
 * @Package: com.yunji.order.emuns
 * @Title: TurnoverStatus
 *
 * History:
 * Date                     Version     Author          Summary
 * ============================================================
 * 2024-10-28 15:23:07      V1.0        HuaAo       新建类
 */

public enum  TurnoverStatus {
    TRADE_SUCCESS(0, "已到账"),
    REFUND_SUCCESS(1, "已退款"),
    REFUND_FAIL(2, "退款失败"),
    PAYOUT_SUCCESS(3,"提现成功"),
    PAYOUT_FAIL(4,"提现失败")
    ;

    private final Integer code;
    private final String text;

    TurnoverStatus(Integer code, String text)
    {
        this.code = code;
        this.text = text;
    }

    public Integer getCode()
    {
        return code;
    }

    public String getText()
    {
        return text;
    }

    public static String get(Integer code)
    {
        if (BeanUtils.isNull(code)) { return null; }
        TurnoverStatus[] enums = TurnoverStatus.values();
        for (TurnoverStatus e: enums )
        {
            if (Objects.equals(e.code, code)) { return e.text; }
        }
        return null;
    }

}